package my.cn.bdqn.life;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TabHost;

public class TabMovieActivity extends TabActivity{
    TabHost tabHost;
    private static final String WATCH="WATCH";
    private static final String WILL="WILL";
    RadioButton rb1,rb2;
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabmovie_layout);
		View view1=getLayoutInflater().inflate(R.layout.tabs_watch_movie, null);
		View view2=getLayoutInflater().inflate(R.layout.tabs_will_movie, null);
		rb1=(RadioButton) view1.findViewById(R.id.rb);
		rb2=(RadioButton) view2.findViewById(R.id.rb);;
		tabHost=getTabHost();
		tabHost.addTab(tabHost.newTabSpec(WATCH).setIndicator(view1).setContent(new Intent(this,WatchMovieActivity.class)));
		tabHost.addTab(tabHost.newTabSpec(WILL).setIndicator(view2).setContent(new Intent(this,WillMovieActivity.class)));		
		tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
			
			public void onTabChanged(String tab) {
				// TODO Auto-generated method stub
				if(tab.equals(WATCH)){
					rb1.setChecked(true);
					rb2.setChecked(false);
				}else if(tab.equals(WILL)){
					rb1.setChecked(false);
					rb2.setChecked(true);
				}
			}
		});
		rb1.setChecked(true);
	}
	
}




